package com.runshu.newsmartark.mvp.presenter;


import com.runshu.newsmartark.mvp.contract.ProductDtaContract;
import com.runshu.newsmartark.network.netbean.ResponseBean;
import com.runshu.newsmartark.network.netinterface.MyCallBack;

/**
 * Demo class
 *
 * @author yu
 * @date 2020/8/11
 * @decs：
 */

public class ProductDtaPresenter implements ProductDtaContract.Presenter {
    private ProductDtaContract.View view;
    private ProductDtaContract.Model model;

    public ProductDtaPresenter(ProductDtaContract.View view, ProductDtaContract.Model model) {
        this.view = view;
        this.model = model;
    }


    @Override
    public void getProductInfo(String productName, String macAddress, int pageSize, int pageNum) {
        model.getProductInfo(productName, macAddress, pageSize, pageNum, new MyCallBack() {
            @Override
            public void onSuccess(ResponseBean data) {
                view.onGetProductSuccess(data);
            }

            @Override
            public void onError(ResponseBean data) {
                view.onError(data.getMessage());
            }
        });
    }
}